package com.aiyige.model;

/**
 * Created by zhuyakun on 2017/9/27.
 */

public class Session {
    private long id = -1; //userId 默认为-1，表示没有登录
    private String avatar = "";
    private String avatarMini = "";
    private long birthday;
    private String city = "";
    private String cityId = "";
    private String createTime;
    private String email = "";
    private String followCount;
    private String fansCount;
    private String introduce = "";
    private int level;
    private String loginName = "";
    private String mobile = "";
    private String nickName = "";
    private int score;
    private int sex;
    private String token = "";

    public Session() {
    }

    private Session(Edit edit) {
        setId(edit.id);
        setAvatar(edit.avatar);
        setAvatarMini(edit.avatarMini);
        setBirthday(edit.birthday);
        setCity(edit.city);
        setCreateTime(edit.createTime);
        setEmail(edit.email);
        setFollowCount(edit.followCount);
        setFansCount(edit.fansCount);
        setIntroduce(edit.introduce);
        setLevel(edit.level);
        setLoginName(edit.loginName);
        setMobile(edit.mobile);
        setNickName(edit.nickName);
        setScore(edit.score);
        setSex(edit.sex);
        setToken(edit.token);
        setCityId(edit.cityId);
    }

    public String getCityId() {
        return cityId;
    }

    public void setCityId(String cityId) {
        this.cityId = cityId;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public boolean isLogin() {
        return id >= 0;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getAvatarMini() {
        return avatarMini;
    }

    public void setAvatarMini(String avatarMini) {
        this.avatarMini = avatarMini;
    }

    public long getBirthday() {
        return birthday;
    }

    public void setBirthday(long birthday) {
        this.birthday = birthday;
    }


    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFollowCount() {
        return followCount;
    }

    public void setFollowCount(String followCount) {
        this.followCount = followCount;
    }

    public String getFansCount() {
        return fansCount;
    }

    public void setFansCount(String fansCount) {
        this.fansCount = fansCount;
    }

    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Edit edit() {
        return new Edit(this);
    }

    public static final class Edit {
        private String sessionId;
        private long id;
        private String avatar;
        private String avatarMini;
        private long birthday;
        private String city;
        private String createTime;
        private String email;
        private String followCount;
        private String fansCount;
        private String introduce;
        private int level;
        private String loginName;
        private String mobile;
        private String nickName;
        private int score;
        private int sex;
        private String token;
        private String cityId;

        public Edit() {
        }

        public Edit(Session copy) {
            this.id = copy.getId();
            this.avatar = copy.getAvatar();
            this.avatarMini = copy.getAvatarMini();
            this.birthday = copy.getBirthday();
            this.city = copy.getCity();
            this.createTime = copy.getCreateTime();
            this.email = copy.getEmail();
            this.followCount = copy.getFollowCount();
            this.fansCount = copy.getFansCount();
            this.introduce = copy.getIntroduce();
            this.level = copy.getLevel();
            this.loginName = copy.getLoginName();
            this.mobile = copy.getMobile();
            this.nickName = copy.getNickName();
            this.score = copy.getScore();
            this.sex = copy.getSex();
            this.token = copy.getToken();
            this.cityId = copy.getCityId();
        }

        public Edit sessionId(String sessionId) {
            this.sessionId = sessionId;
            return this;
        }

        public Edit id(int id) {
            this.id = id;
            return this;
        }

        public Edit avatar(String avatar) {
            this.avatar = avatar;
            return this;
        }

        public Edit avatarMini(String avatarMini) {
            this.avatarMini = avatarMini;
            return this;
        }

        public Edit birthday(long birthday) {
            this.birthday = birthday;
            return this;
        }

        public Edit city(String city) {
            this.city = city;
            return this;
        }

        public Edit createTime(String createTime) {
            this.createTime = createTime;
            return this;
        }

        public Edit email(String email) {
            this.email = email;
            return this;
        }

        public Edit followCount(String followCount) {
            this.followCount = followCount;
            return this;
        }

        public Edit fansCount(String fansCount) {
            this.fansCount = fansCount;
            return this;
        }

        public Edit introduce(String introduce) {
            this.introduce = introduce;
            return this;
        }

        public Edit level(int level) {
            this.level = level;
            return this;
        }

        public Edit loginName(String loginName) {
            this.loginName = loginName;
            return this;
        }

        public Edit mobile(String mobile) {
            this.mobile = mobile;
            return this;
        }

        public Edit nickName(String nickName) {
            this.nickName = nickName;
            return this;
        }

        public Edit score(int score) {
            this.score = score;
            return this;
        }

        public Edit sex(int sex) {
            this.sex = sex;
            return this;
        }

        public Edit token(String token) {
            this.token = token;
            return this;
        }

        public Edit cityId(String cityId) {
            this.cityId = cityId;
            return this;
        }

        public void commit() {
            //SessionUtil.updateCurrentSession(new Session(this));
        }
    }
}
